#ifndef RESPONSIVEAPPLICATION_H
#define RESPONSIVEAPPLICATION_H

#include <QApplication>
#include <QElapsedTimer>
#include <QDebug> // 添加此行以包含 QDebug

class ResponsiveApplication : public QApplication {
public:
    ResponsiveApplication(int &argc, char **argv)
        : QApplication(argc, argv) {}

    bool notify(QObject *receiver, QEvent *event) override {
        QElapsedTimer timer;
        timer.start();
        bool res = QApplication::notify(receiver, event);
        if (timer.elapsed() > 50) {
            qWarning() << "Long event processing:" << receiver << event
                      << "took" << timer.elapsed() << "ms";
        }
        return res;
    }
};

#endif // RESPONSIVEAPPLICATION_H



